<?php

class Server
{

    const PORT = 8811;

    public function port()
    {

        $shell = 'netstat -anp 2>/dev/null | grep '.self::PORT.' | grep LISTEN | wc -l';
        $result = shell_exec($shell);
        if($result != 1){
            echo date('Y-m-d H:i:s').' error'.PHP_EOL;
        }else{
            echo date('Y-m-d H:i:s').' ok'.PHP_EOL;
        }
    }

}

Swoole\Timer::tick(1000, function(){
    (new Server())->port();
});
